﻿@model EnetaMvc.Web.Models.FrontPageModel
@{
    BlogPostDto firstPost = Model.BlogPosts.FirstOrDefault();
    BlogPostDto secondPost = Model.BlogPosts.Skip(1).FirstOrDefault();
    IList<BlogPostDto> firstFive = Model.BlogPosts.Skip(2).Take(5).ToList();
    IList<BlogPostDto> secondFive = Model.BlogPosts.Skip(7).Take(5).ToList();

    ArticleDto firstArticle = Model.Articles.FirstOrDefault();
    IList<ArticleDto> fiveArticles = Model.Articles.Skip(1).Take(5).ToList();
}           
<div class="inform-area">
	<div class="inform-area-head">
		<h2><a href="@Url.Content("~/news/")">@Resources.EnetaMvc.NewsAndArticles</a></h2>
	</div>
	<div class="inform-area-box">
		<div class="information">
			<div class="first">
                @if(firstPost != null)
                {
				    <h4><a href="@Url.Content("~/news/blogs/posts/details/" + firstPost.Id)">@firstPost.Title</a></h4>
				    <p>@Html.Raw(firstPost.Abstract)</p>
				    <span>@string.Join(", ",firstPost.Tags.Select(t => t.Name))</span> <span>@firstPost.Created.ToShortDateString()  |  @firstPost.BlogName</span> 
                }
            </div>
			<div>
				@if (secondPost != null)
                {
				    <h4><a href="@Url.Content("~/news/blogs/posts/details/" + secondPost.Id)">@secondPost.Title</a></h4>
				    <p>@Html.Raw(secondPost.Abstract)</p>
				    <span>@string.Join(", ",secondPost.Tags.Select(t => t.Name))</span> <span>@secondPost.Created.ToShortDateString()  |  @secondPost.BlogName</span> 
                }
            </div>
			<div>
				@if (firstArticle != null)
                {
				    <h4><a href="@Url.Content("~/news/articles/details/" + firstArticle.Id)">@firstArticle.Title</a></h4>
				    <p>@Html.Raw(firstArticle.Abstract)</p>
				    <span>@string.Join(", ",firstArticle.Tags.Select(t => t.Name))</span> <span>@firstArticle.Created.ToShortDateString()  |  @firstArticle.CreatedByUserName</span> 
                }
			</div>
		</div>
		<div class="news-area">
			<div class="blog-area">
				<h3><a href="@Url.Content("~/news/blogs/posts/")">@Resources.EnetaMvc.Blogs</a></h3>
				<div class="blog-box first">                        
					<ul class="list">
                        @foreach(var blogPost in firstFive)
                        {
						    <li><a href="@Url.Content("~/news/blogs/posts/details/" + blogPost.Id)">@blogPost.Title <span>(2)</span></a></li>
                        }
					</ul>
				</div>
				<div class="blog-box">
					<ul class="list">
						@foreach(var blogPost in secondFive)
                        {
						    <li><a href="@Url.Content("~/news/blogs/posts/details/" + blogPost.Id)">@blogPost.Title <span>(2)</span></a></li>
                        }
					</ul>
				</div>
			</div>
			<div class="side-area">
				<h3><a href="@Url.Content("~/news/articles/")">@Resources.EnetaMvc.Articles</a></h3>
				<ul class="list">
					@foreach(var article in fiveArticles)
                    {
						<li><a href="@Url.Content("~/news/articles/details/" + article.Id)">@article.Title <span>(2)</span></a></li>
                    }
				</ul>
			</div>
		</div>
		<div class="tools">
			<div class="slide-box">
				<div class="slide-box-center">
					<div class="slide-box-bottom"> <a class="close" href="#">close</a>
						<div>
							<p>Blogija! <a href="#">Logi sisse</a> ja lisa oma blogi RSS-voog Eneta portaali.</p>
						</div>
					</div>
				</div>
			</div>
			<a class="more" href="@Url.Content("~/news/")">@Resources.EnetaMvc.AllNewsAndArticles</a> </div>
	</div>
	<span class="inform-area-btm">&nbsp;</span> 
</div>